export class Result {
  code: number;
  msg: string;
  data: object;

  constructor(code: number, msg: string, data: object) {
    this.code = code;
    this.data = data;
    this.msg = msg;
  }

  public static success(data: any, msg?: string): Result {
    return new Result(200, msg || 'success', data);
  }

  public static message(msg: string): Result {
    return new Result(200, msg, null);
  }

  public static error(code: number, msg: string): Result {
    return new Result(code, msg, null);
  }
}
